package com.joker.es.remote.factory;


import com.joker.common.core.domain.Result;
import com.joker.es.remote.ProductEsRemote;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author lemon
 * @date 2024/12/19 20:27
 **/
@Slf4j
@Component
public class ProductEsRemoteFallbackFactory implements FallbackFactory<ProductEsRemote> {
    @Override
    public ProductEsRemote create(Throwable cause) {
        return new ProductEsRemote() {
            @Override
            public Result<Boolean> addBatch(String data) {
                log.error(cause.getMessage());
                return Result.error("远程调用失败");
            }
        };
    }
}
